package com.itheima.filter1;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/life")//拦截 life servlet资源的
public class LifeFilter implements Filter {
    // 初始化的方法  如果构造已调用就后调用init
    public void init(FilterConfig config) throws ServletException {
        System.out.println("Lifefilter对象呱呱坠地");
    }
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {

        System.out.println("执行过滤功能！");
        chain.doFilter(req, resp);
    }

    public void destroy() {

        System.out.println("lifeServlet 时日不多，即将翘辫子");
    }

}
